/*
 * @Description:
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2023-04-30 12:22:02
 * @LastEditors: swc
 * @LastEditTime: 2024-09-24 11:34:41
 */
import { T_combobox_conf } from '@/components/base/input/o-combobox/types';
import { T_srv, Tsrv, ifs, ts, tvs, vue } from '@/services';
import { N_oSimpleToolbar } from '../../toolbar/o-simple-toolbar/types';
import SetupAttrCurrent from './attrCurrent.vue';
import SetupAttrDetail from './attrDetail.vue';
import SetupAttrLibfield from './attrLibField.vue';
import SetupAttrMenu from './attrMenu.vue';
import { I_command, T_command, VtoolbarState } from './command/command';
import ComponentsPanel from './componentsPanel.vue';
import LayoutEditor from './editor.vue';
import LayoutsPanel from './layoutsPanel.vue';
import { N_oSetupPanel } from './types';

const defaultToolbarList = (): Array<N_oSimpleToolbar.I_Conf> => {
  return [
    {
      key: 'new',
      type: 'button',
      class: 'wy-rule-new',
      title: '新增模板',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: false,
      separator: false
    },
    {
      key: 'modify',
      type: 'button',
      class: 'wy-bianji',
      title: '编辑模板',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'delete',
      type: 'button',
      class: 'wy-delete',
      title: '删除模板',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    },
    {
      key: 'save',
      type: 'button',
      class: 'wy-baocun41',
      // public/lang里可以配置国际化
      title: '保存模板或配置',
      // 按下的样式 单锁开关按扭样式控制
      isOpen: false,
      disabled: true,
      separator: false
    }
  ];
};
const conf: T_combobox_conf = {
  size: 'small', // 可选值为large、small、default或者不填
  placeholder: 'oSetupPanel.SetupAttrDetail.selDBType', // 选择框默认文字 i18n value
  i18n: {
    field: false, // 属性字段是否国际化转换
    list: false // 数据list是否国际化转换
  },
  multiple: false, // 多选时返回数组，单选时返回对象
  disabled: false,
  // 过滤
  filter: {
    // $and:{name:'xxx',name1:8,$or:[{name:1},{name1:2}]} //启用过滤会降低性能
  },
  // 列表字段
  field: ['value', 'label'], // 注意与数据对应顺序
  keyField: 'value', // 一行的key值字段
  displayField: 'label', // 选择后显示的字段
  // 数据列表
  list: [
    {
      type: 'text', // iconFont 图字符列表 | text 文字列表
      disabled: false,
      data: {
        value: 'mysql',
        label: 'mysqlDB'
      }
    },
    {
      type: 'text', // iconFont 图字符列表 | text 文字列表
      disabled: false,
      data: {
        value: 'mongo',
        label: 'mongoDB'
      }
    }
  ]
};

const auditDefaultFields = (): Array<any> => {
  return [
    {
      fieldID: Tsrv.lexicon.setupAuditDefaultFieldsConf.audited.fieldID,
      field: Tsrv.lexicon.setupAuditDefaultFieldsConf.audited.field,
      type: Tsrv.lexicon.setupAuditDefaultFieldsConf.audited.type,
      isShow: false,
      notNull: true,
      defValue: Tsrv.lexicon.setupAuditDefaultFieldsConf.audited.defValue,
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: Tsrv.lexicon.setupAuditDefaultFieldsConf.audited.selectionID,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      nodeData: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '',
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: {
        toTable: '',
        toField: '',
        isDropdown: false,
        customSearch: '',
        multiConnect: '',
        isFunLayout: true,
        fields: []
      },
      align: 'left',
      subQuery: ''
    },
    {
      fieldID: Tsrv.lexicon.setupAuditDefaultFieldsConf.status.fieldID,
      field: Tsrv.lexicon.setupAuditDefaultFieldsConf.status.field,
      type: Tsrv.lexicon.setupAuditDefaultFieldsConf.status.type,
      isShow: false,
      notNull: true,
      defValue: Tsrv.lexicon.setupAuditDefaultFieldsConf.status.defValue,
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: Tsrv.lexicon.setupAuditDefaultFieldsConf.status.selectionID,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      nodeData: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '',
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: {
        toTable: '',
        toField: '',
        isDropdown: false,
        customSearch: '',
        multiConnect: '',
        isFunLayout: true,
        fields: []
      },
      align: 'left',
      subQuery: ''
    },
    {
      fieldID: Tsrv.lexicon.setupAuditDefaultFieldsConf.previousStatus.fieldID,
      field: Tsrv.lexicon.setupAuditDefaultFieldsConf.previousStatus.field,
      type: Tsrv.lexicon.setupAuditDefaultFieldsConf.previousStatus.type,
      isShow: false,
      notNull: true,
      defValue:
        Tsrv.lexicon.setupAuditDefaultFieldsConf.previousStatus.defValue,
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID:
        Tsrv.lexicon.setupAuditDefaultFieldsConf.previousStatus.selectionID,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      nodeData: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '',
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: {
        toTable: '',
        toField: '',
        isDropdown: false,
        customSearch: '',
        multiConnect: '',
        isFunLayout: true,
        fields: []
      },
      align: 'left',
      subQuery: ''
    },
    {
      fieldID: Tsrv.lexicon.setupAuditDefaultFieldsConf.reviewer.fieldID,
      field: Tsrv.lexicon.setupAuditDefaultFieldsConf.reviewer.field,
      type: Tsrv.lexicon.setupAuditDefaultFieldsConf.reviewer.type,
      isShow: false,
      notNull: false,
      defValue: '',
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: null,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '', // 联查过滤
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: {
        toTable:
          Tsrv.lexicon.setupAuditDefaultFieldsConf.reviewer.many2one.toTable,
        toField:
          Tsrv.lexicon.setupAuditDefaultFieldsConf.reviewer.many2one.toField,
        isDropdown: false,
        customSearch: '',
        multiConnect: '',
        fields: [],
        isFunLayout: true
      },
      align: 'left',
      subQuery: '',
      nodeData: false,
      notDel: false
    },
    {
      fieldID: Tsrv.lexicon.setupAuditDefaultFieldsConf.auditTime.fieldID,
      field: Tsrv.lexicon.setupAuditDefaultFieldsConf.auditTime.field,
      type: Tsrv.lexicon.setupAuditDefaultFieldsConf.auditTime.type,
      isShow: false,
      notNull: false,
      defValue: '',
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: null,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '', // 联查过滤
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: '',
      align: 'left',
      subQuery: '',
      nodeData: false,
      notDel: false
    }
  ];
};

const recordsDefaultFields = (): Array<any> => {
  return [
    {
      fieldID: Tsrv.lexicon.setupRecordsDefaultFieldsConf.createor.fieldID,
      field: Tsrv.lexicon.setupRecordsDefaultFieldsConf.createor.field,
      type: Tsrv.lexicon.setupRecordsDefaultFieldsConf.createor.type,
      isShow: false,
      notNull: false,
      defValue: '',
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: null,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '', // 联查过滤
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: {
        toTable:
          Tsrv.lexicon.setupRecordsDefaultFieldsConf.createor.many2one.toTable,
        toField:
          Tsrv.lexicon.setupRecordsDefaultFieldsConf.createor.many2one.toField,
        isDropdown: false,
        customSearch: '',
        multiConnect: '',
        fields: [],
        isFunLayout: true
      },
      align: 'left',
      subQuery: '',
      nodeData: false,
      notDel: false
    },
    {
      fieldID: Tsrv.lexicon.setupRecordsDefaultFieldsConf.createTime.fieldID,
      field: Tsrv.lexicon.setupRecordsDefaultFieldsConf.createTime.field,
      type: Tsrv.lexicon.setupRecordsDefaultFieldsConf.createTime.type,
      isShow: false,
      notNull: false,
      defValue: '',
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: null,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '', // 联查过滤
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: '',
      align: 'left',
      subQuery: '',
      nodeData: false,
      notDel: false
    },
    {
      fieldID: Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyUser.fieldID,
      field: Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyUser.field,
      type: Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyUser.type,
      isShow: false,
      notNull: false,
      defValue: '',
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: null,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '', // 联查过滤
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: {
        toTable:
          Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyUser.many2one
            .toTable,
        toField:
          Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyUser.many2one
            .toField,
        isDropdown: false,
        customSearch: '',
        multiConnect: '',
        fields: [],
        isFunLayout: true
      },
      align: 'left',
      subQuery: '',
      nodeData: false,
      notDel: false
    },
    {
      fieldID: Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyTime.fieldID,
      field: Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyTime.field,
      type: Tsrv.lexicon.setupRecordsDefaultFieldsConf.modifyTime.type,
      isShow: false,
      notNull: false,
      defValue: '',
      fieldPrefix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      fieldSuffix: {
        icon: '',
        iconStatus: '',
        content: ''
      },
      placeholder: '',
      comment: '',
      selectionID: null,
      disabled: true,
      defaultFilter: false,
      fixedLeft: false,
      fixedRight: false,
      footerMethod: null,
      formatter: {
        type: '',
        decimal: 0,
        thousandmark: false,
        currency: ''
      },
      actions: [],
      cascadeFilter: '', // 联查过滤
      auxProp: '',
      minWidth: '',
      appWeight: '',
      isDes: false,
      many2one: '',
      align: 'left',
      subQuery: '',
      nodeData: false,
      notDel: false
    }
  ];
};

const COMP_BASE_TAB_NAME = N_oSetupPanel.N_comps.COMP_NAME.BASE_TAB;

const COMP_BASE_DATA_NAV_NAME = N_oSetupPanel.N_comps.COMP_NAME.DATE_NAV;

const COMP_REF_COMP_NAME = N_oSetupPanel.N_comps.COMP_NAME.REF_COMP;

const COMP_BASE_GRID_NAME = N_oSetupPanel.N_comps.COMP_NAME.BASE_GRID;

const COMP_BASE_PANEL_NAME = N_oSetupPanel.N_comps.COMP_NAME.BASE_PANEL;

const COMP_REF_BASE_GRID_NAME = N_oSetupPanel.N_comps.COMP_NAME.REF_BASE_GRID;

const COMP_BASE_VIEW_NAME = N_oSetupPanel.N_comps.COMP_NAME.BASE_VIEW;

const COMP_CBASE_FORM_NAME = N_oSetupPanel.N_comps.COMP_NAME.C_BASE_FORM;

const COMP_GRAPH_NAME = N_oSetupPanel.N_comps.COMP_NAME.GRAPH;

const COMP_REF_GRAPH_NAME = N_oSetupPanel.N_comps.COMP_NAME.REF_GRAPH;

const COMP_MULTI_FORM_NAME = N_oSetupPanel.N_comps.COMP_NAME.MULTI_FORM;

const COMP_DATE_NAV_NAME = N_oSetupPanel.N_comps.COMP_NAME.DATE_NAV;

const COMP_TREE_GRID_NAME = N_oSetupPanel.N_comps.COMP_NAME.TREE_GRID;

const COMP_REPORT_CHART_NAME = N_oSetupPanel.N_comps.COMP_NAME.REPORT_CHART;

const COMP_CLONE_BASE_PANEL_NAME =
  N_oSetupPanel.N_comps.COMP_NAME.CLONE_BASE_PANEL;

export {
  COMP_BASE_DATA_NAV_NAME,
  COMP_BASE_GRID_NAME,
  COMP_BASE_PANEL_NAME,
  COMP_BASE_TAB_NAME,
  COMP_BASE_VIEW_NAME,
  COMP_CBASE_FORM_NAME,
  COMP_CLONE_BASE_PANEL_NAME,
  COMP_DATE_NAV_NAME,
  COMP_GRAPH_NAME,
  COMP_MULTI_FORM_NAME,
  COMP_REF_BASE_GRID_NAME,
  COMP_REF_COMP_NAME,
  COMP_REF_GRAPH_NAME,
  COMP_REPORT_CHART_NAME,
  COMP_TREE_GRID_NAME,
  ComponentsPanel,
  I_command,
  LayoutEditor,
  LayoutsPanel,
  N_oSetupPanel,
  SetupAttrCurrent,
  SetupAttrDetail,
  SetupAttrLibfield,
  SetupAttrMenu,
  T_combobox_conf,
  T_command,
  T_srv,
  Tsrv,
  VtoolbarState,
  auditDefaultFields,
  conf,
  defaultToolbarList,
  ifs,
  recordsDefaultFields,
  ts,
  tvs,
  vue
};
